.gemModelContainer {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
  height: 100%;
  max-height: 80vh;
  padding: 20px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  // 添加硬件加速以减少闪烁
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;

  .gemModelHeader {
    text-align: center;
    margin-bottom: 20px;
    color: white;

    .headerTitle {
      font-size: 24px;
      font-weight: bold;
      display: block;
      margin-bottom: 5px;
    }

    .headerSubtitle {
      font-size: 16px;
      opacity: 0.9;
    }
  }

  .selectionInfo {
    width: 80%;
    background-color: rgba(255, 255, 255, 0.9);
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    // 添加过渡效果
    transition: all 0.2s ease;

    .selectionCount {
      font-size: 18px;
      color: #333;
      margin-bottom: 10px;
      text-align: center;

      .countNumber {
        font-weight: bold;
        color: #667eea;
        font-size: 20px;
      }
    }

    .selectionColors {
      display: flex;
      justify-content: center;
      gap: 10px;
      flex-wrap: wrap;

      .colorBadge {
        padding: 5px 10px;
        border-radius: 15px;
        font-size: 14px;
        font-weight: bold;
        color: white;
        text-transform: capitalize;
        // 添加过渡效果
        transition: all 0.2s ease;

        &.red-badge {
          background-color: #ff6b6b;
        }

        &.blue-badge {
          background-color: #4d96ff;
        }

        &.green-badge {
          background-color: #6bcb77;
        }

        &.gold-badge {
          background-color: #ffd93d;
          color: #333;
        }

        &.black-badge {
          background-color: #666;
        }

        &.white-badge {
          background-color: #f0f0f0;
          color: #333;
          border: 1px solid #ccc;
        }

        &.pink-badge {
          background-color: #ff99cc;
        }
      }
    }
  }

  .btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    width: 80%;
    justify-content: center;

    .actionBtn {
      flex: 1;
      padding: 12px 20px;
      border-radius: 25px;
      font-size: 16px;
      font-weight: bold;
      border: none;
      cursor: pointer;
      transition: all 0.3s ease;
      // 添加硬件加速
      transform: translateZ(0);
      backface-visibility: hidden;

      &.confirmBtn {
        background-color: #4caf50;
        color: white;

        &:hover {
          background-color: #45a049;
          transform: translateY(-2px) translateZ(0);
        }
      }

      &.resetBtn {
        background-color: #f44336;
        color: white;

        &:hover {
          background-color: #da190b;
          transform: translateY(-2px) translateZ(0);
        }
      }

      &.closeBtn {
        background-color: #667eea;
        color: white;

        &:hover {
          background-color: #5a6fd8;
          transform: translateY(-2px) translateZ(0);
        }
      }
    }
  }

  .gemList {
    display: flex;
    flex-direction: column;
    width: 80%;
    margin: 20px 10px;
    border: 2px solid #fff;
    border-radius: 12px;
    background-image: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDe0Ro8fG8NY0HpDQbsS5a8YJlAXj7MgACTCEAAgm3kVdokKKQ4eTIzTYE.jpg");
    background-repeat: no-repeat;
    background-size: cover;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    // 添加硬件加速
    transform: translateZ(0);
    backface-visibility: hidden;

    .grid-row {
      display: flex;
      flex-direction: row;
    }

    .grid-cell {
      flex: 1;
      aspect-ratio: 1 / 1; // 保持正方形（现代浏览器支持）
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid rgba(255, 255, 255, 0.5);
      border-radius: 8px;
      position: relative;
      transition: all 0.2s ease;
      cursor: pointer;
      // 添加硬件加速
      transform: translateZ(0);
      backface-visibility: hidden;
      background-size: cover;

      &:hover {
        transform: scale(1.05) translateZ(0);
        border-color: rgba(255, 255, 255, 0.8);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      }

      &.selected {
        border: 3px solid #ffd700 !important;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
        transform: scale(1.1) translateZ(0);
        z-index: 2;
        will-change: transform, box-shadow; // 提示浏览器优化这些属性

        .selectedIndicator {
          position: absolute;
          top: -8px;
          right: -8px;
          width: 24px;
          height: 24px;
          background-color: #ffd700;
          border-radius: 50%;
          display: flex;
          align-items: center;
          justify-content: center;
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
          // 添加过渡效果
          transition: all 0.2s ease;

          .selectedNumber {
            font-size: 14px;
            font-weight: bold;
            color: #333;
          }
        }
      }
      
      &.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        
        &:hover {
          transform: none;
          border-color: rgba(255, 255, 255, 0.5);
          box-shadow: none;
        }
      }
    }

    .red-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDe0Jo8fG86LQ55wEn4XqdXKOi1zCPHwACSiEAAgm3kVfAdFazE3qw3DYE.png")
        no-repeat center;
      background-size: cover;
    }

    .blue-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDe0Bo8fG371QHiXEzAaSMYUO0oEXWVgACSCEAAgm3kVd0dE_vl27q4jYE.png")
        no-repeat center;
      background-size: cover;
    }

    .green-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDez9o8fG3DnUzAT-nJVd9EDxcCfxRgAACRyEAAgm3kVcTMz2farlPLTYE.png")
        no-repeat center;
      background-size: cover;
    }

    .pink-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDe0Fo8fG37wMFEY0CzuRye0ZQ8RRN8AACSSEAAgm3kVcipeSVCe3TjjYE.png")
        no-repeat center;
      background-size: cover;
    }

    .black-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDez1o8fG3gnh1di8o4dh3i1QIVhp2xAACRSEAAgm3kVeXx91YLBbu4jYE.png")
        no-repeat center;
      background-size: cover;
    }

    .white-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDez5o8fG3IsmpaBMkWKVe-PE5C070kQACRiEAAgm3kVfuZEJhbpkwhTYE.png")
        no-repeat center;
      background-size: cover;
    }

    .gold-gem {
      background: url("https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEDe0No8fG8lC520Z4sqxuv2szLiU51hwACSyEAAgm3kVe9agb3mknfwDYE.png")
        no-repeat center;
      background-size: cover;
    }
    
    .empty {
      background: transparent;
      border: 2px dashed rgba(255, 255, 255, 0.3);
    }
  }
}

// 响应式：小屏幕适配
@media (max-width: 480px) {
  .gemModelContainer {
    padding: 10px;

    .gemModelHeader {
      .headerTitle {
        font-size: 20px;
      }

      .headerSubtitle {
        font-size: 14px;
      }
    }

    .selectionInfo {
      width: 90%;
      padding: 10px;

      .selectionCount {
        font-size: 16px;
      }
    }

    .btns {
      width: 90%;
      flex-direction: column;

      .actionBtn {
        width: 100%;
        margin-bottom: 10px;
      }
    }
  }

  .gemList {
    width: 90%;
  }

  .grid-cell {
    font-size: 14px;
  }
}
